package cn.fl.spl.transform;

import cn.cmm.base.framework.utils.CollectionUtils;
import cn.fl.base.spl.transform.BaseSplLimRateVOTransform;
import cn.fl.spl.vo.SplLimRateVO;
import fl.spl.facade.spllim.dto.SplLimRateDTO;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description:  转换器
 * @Description: 服务层与展现层转换类
 * @Description: 所有的PO只能在持久成和服务层使用
 * @Description: 所有的DTO只能在展现层和服务层使用
 * @Description: 在服务层中向下是DTO转PO,向上是PO转DTO
 */
public class SplLimRateVOTransform extends BaseSplLimRateVOTransform {


	/**
	 * VO 转  DTO
	 *
	 * @param vo SplLimRateVO
	 * @return SplLimRateDTO
	 */
	public static SplLimRateDTO toDTO(SplLimRateVO vo) {

		SplLimRateDTO dto = baseToDTO(vo);
		//设置自定义扩展属性
		return dto;
	}

	/**
	 * DTO 转  VO
	 * @param dto SplLimRateDTO
	 * @return SplLimRateVO
	 */
	public static SplLimRateVO toVO(SplLimRateDTO dto) {
		SplLimRateVO po = baseToVO(dto);
		//设置自定义扩展属性
		return po;
	}
	
	/**
	 * VO集合 转 DTO集合
	 * @param list List<SplLimRateVO>
	 * @return List<SplLimRateDTO>
	 */
	public static List<SplLimRateDTO> toDTOList(List<SplLimRateVO> list) {
		List<SplLimRateDTO>  dtoList = new ArrayList<SplLimRateDTO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (SplLimRateVO vo : list) {
				dtoList.add(toDTO(vo));
			}
		}
		return dtoList;
	}

	/**
	 * DTO集合 转 VO集合
	 * @param dtoList List<SplLimRateDTO>
	 * @return List<SplLimRateVO>
	 */
	public static List<SplLimRateVO> toVOList(List<SplLimRateDTO> dtoList) {
		List<SplLimRateVO>  voList = new ArrayList<>();
		if(CollectionUtils.isNotEmpty(dtoList)){
			for (SplLimRateDTO vo : dtoList) {
				voList.add(toVO(vo));
			}
		}
		return voList;
	}
}
